CREATE OR REPLACE FUNCTION actualizarusuario(integer, text, text, text, integer, bytea, text)
  RETURNS void AS
$BODY$declare
begin 
    update persona set nombre=$2,apellido=$3,correo=$4,id_pais=$5,imagen=$6 where id_persona=$1;
    update sesion set username=$7 where id_persona=$1;
return;
end;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
ALTER FUNCTION actualizarusuario(integer, text, text, text, integer, bytea, text) OWNER TO postgres;
------segunda funcion-----------------------------
CREATE OR REPLACE FUNCTION insertardatos(text, text, text, integer, text, text)
  RETURNS void AS
$BODY$declare
   id bigint;
begin 
   insert into persona(nombre,apellido,correo,id_pais)values($1,$2,$3,$4);
   id :=lastVal();
   insert into sesion values(id,$5,$6);
   return;
end;
  $BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
ALTER FUNCTION insertardatos(text, text, text, integer, text, text) OWNER TO postgres;
